package icu.yougan.trade.mapper;

import icu.yougan.trade.entity.ChatMessage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ChatMessageMapper {
    int insertChatMessage(ChatMessage message);

    List<ChatMessage> selectRecentConversations(@Param("userId") Long userId);

    List<ChatMessage> getPrivateMessages(
            @Param("sender") Long sender,
            @Param("receiver") Long receiver);

    List<ChatMessage> getItemMessages(@Param("itemId") Long itemId);

    int updateReadStatus(@Param("id") Long id, @Param("isRead") Boolean isRead);

    boolean deleteConversations(@Param("ids")List<Long> ids);

    boolean updateDeleteUserId(@Param("ids")List<Long> ids,@Param("deleteUserId") Long deleteUserId);
    boolean getDeleteIsTrue(@Param("ids")List<Long> id);
    boolean batchUpdateReadStatusAndDeleteStatus(Long Id);
}